package com.ccapton.dragviewdemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.MotionEvent;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.ccapton.dragview.DragView;

public class MainActivity extends AppCompatActivity {

    private TextView tvContent;
    private EditText etInput;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ((DragView)findViewById(R.id.dragview)).setOnDragViewClickListener(new DragView.OnDragViewClickListener() {
            @Override
            public void onDragViewClick(View view) {
                Toast.makeText(MainActivity.this,"hello",Toast.LENGTH_SHORT).show();
            }
        });
        ((DragView)findViewById(R.id.dragview2)).setOnDragViewClickListener(new DragView.OnDragViewClickListener() {
            @Override
            public void onDragViewClick(View view) {
                Toast.makeText(MainActivity.this,"helloWorld",Toast.LENGTH_SHORT).show();
            }
        });

        etInput = findViewById(R.id.et_input);
        tvContent = findViewById(R.id.tv_content);
        etInput.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {

            }

            @Override
            public void afterTextChanged(Editable s) {
                tvContent.setText(s);
            }
        });


    }
}
